<?php if( $this->tr_error ) { ?>	
	<h2 class="bold"><?php echo $this->translate( 'your_basket' ) ?></h2>
	
	<div class="content"><?php echo $this->translate( 'tr_error' ); ?></div>
<?php } else { ?>
	<!--[if lte IE 8.0]>
	<script type="text/javascript" src="<?php echo $this->baseUrl() ?>/public/js/fix-zindex.js"></script>
	<![endif]-->
	<script type="text/javascript" src="<?php echo $this->baseUrl() ?>/public/js/jquery.md5.js"></script>
	
	<div class="shoptop"><?php echo $this->translate( 'your_basket' ) ?></div>
<div class="box boxbasket">
	
	<div class="prodpage">
		<div class="acenter">
			<a href="javascript:void(null)" class="button prodmenu"><?php echo $this->translate( 'basket_contents' ) ?></a>
			<a href="javascript:void(null)" class="button prodmenu"><?php echo $this->translate( 'basket_delivery' ) ?></a>
			<a href="javascript:void(null)" class="button prodmenu"><?php echo $this->translate( 'basket_payment' ) ?></a>
			<a href="javascript:void(null)" class="button prodmenu  buttonactive"><?php echo $this->translate( 'basket_confirmation' ) ?></a>
		</div>
	</div>
	<!-- start bar -->
	<div class="basketbar">
	
		<div class="sekction sekpos1">
			<p class="price"><?php 
				echo number_format( $this->basket->sumInt + $this->basket->deliveryInt, 2, '.', ' ' );
				echo ' ' . $this->basket->curr;
			?></p>
			<p class="name"><?php echo $this->translate( 'payment_all' ); ?></p>
		</div>
		
		<div class="ordernumber">
		<?php echo $this->translate( 'order_nr' ) ?>: <span><?php echo $this->nr_order ?></span>
		</div>
		
	</div>
	
		
    	<?php if(isSet($this->basket->sess->basket['value_vouchers'])) {?>
    	<div class="basketbar">
    		<div style="position:absolute; left:27px; top:31px">
    			<p class="name"><?php echo $this->translate( 'delivery_voucher_value_do' ); ?>: </p>
    		</div>
    		<div style="position:absolute; left:375px; top:30px">
    		<p class="price">
    			<?php 
    			    $sdv = number_format( $this->basket->sumInt + $this->basket->deliveryInt - $this->basket->sess->basket['value_vouchers'], 2, '.', ' ' );
    			    if($sdv>0) echo $sdv; else echo number_format(0, 2, '.', ' ' );
    			    echo $this->basket->curr;
    		    ?>
    		</p>
    		</div>
    	</div>
    	<?php }?>
		<div class="options">
		<a href="{baseUrl}/shop" class="button"><?php echo $this->translate( 'back_to_shop' ); ?></a>
		<a href="{baseUrl}/shop/orders/fav/<?php echo $this->nr_order?>/proforma/1" class="button button2"><?php echo $this->translate( 'print_order' ) ?></a>
		<div class="clr"></div>
	</div>
	<!-- end options -->

	<div class="end"></div>
	
	
		<table class="stoproc">
		<tr>
		<td style="vertical-align:top"><a href="<?php echo $this->baseUrl() ?>/shop" class="button4"><?php echo $this->translate( 'back_to_shop' ); ?></a></td>
		<?php 
		/*
		p1 - płatność za pobraniem,
		p2 - płatność kartą kredytową,
		p3 - płatność przelewem online,
		p4 - wpłata na konto,
		p5 - płatność paypalem.
		*/
		?>
		<?php echo $this->error; ?>
		<td class="acenter" style="vertical-align:top">
		<?php if($this->payment == 'p5'){ 
		
			$suma = number_format( ($this->basket->sumInt + $this->basket->deliveryInt) - $this->basket->sess->basket['value_vouchers'], 2, '.', ' ' );
			$explode = explode(".", $suma);
			$grosze = $explode[0].$explode[1];
			$session = md5(time());
			$session_id = substr($session,0, 7);
			
		?>
		
		<form name="_xclick" action="https://www.paypal.com/pl/cgi-bin/webscr" method="post">
		<input type="hidden" name="cmd" value="_xclick">
		<input type="hidden" name="business" value="paypal@carnauba.pl">
		<input type="hidden" name="currency_code" value="<?php echo $this->basket->curr ?>">
		<input type="hidden" name="item_name" value="<?php echo $this->nr_order; ?>">
		<input type="hidden" name="amount" value="<?php echo $grosze; ?>">
		<?php if ( $this->nr_order && $grosze < 0 ) ?>
		<input type="image" src="<?php echo $this->baseUrl() ?>/public/images/zaplacpaypal.jpg" border="0" name="submit" alt="Płać za pomocą systemu PayPal — jest szybki, bezpłatny i bezpieczny!">
		</form>	
		
		<?php } elseif($this->payment == 'p2') {
		
			$suma = number_format( ($this->basket->sumInt + $this->basket->deliveryInt) - $this->basket->sess->basket['value_vouchers'], 2, '.', ' ' );
			$explode = explode(".", $suma);
			$grosze = $explode[0].$explode[1];
			$session = md5(time());
			$session_id = substr($session,0, 7);
			
		?>
		<form action="https://www.platnosci.pl/paygw/ISO/NewPayment" method="post" name="payform">
		<input type="hidden" name="first_name" value="<?php echo $this->name; ?>">
		<input type="hidden" name="last_name" value="<?php echo $this->surname; ?>">
		<input type="hidden" name="email" value="<?php echo $this->email; ?>">	
		<input type="hidden" name="pos_id" value="39289">
		<input type="hidden" name="pos_auth_key" value="cVQb72R">
		<input type="hidden" name="session_id" value="<?php echo $session_id;?>">
		<input type="hidden" name="order_id" value="<?php echo $this->nr_order;?>">
		<input type="hidden" name="amount" value="<?php echo preg_replace( '/\ /', '', $grosze ); ?>">
		<input type="hidden" name="desc" value="<?php echo $this->nr_order; ?>">
		<input type="hidden" name="client_ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
		<?php if( $grosze > 0 ) { ?>
		<input type="image" src="<?php echo $this->baseUrl() ?>/public/images/poprzezplatnosci.jpg" alt="Zapłać poprzez Platnosci.pl" value="Zapłać poprzez Platnosci.pl">
		<?php } ?>
		</form>
			
		<?php } elseif ($this->payment == 'p3') {
		
			$suma = number_format( ($this->basket->sumInt + $this->basket->deliveryInt) - $this->basket->sess->basket['value_vouchers'], 2, '.', ' ' );
			$explode = explode(".", $suma);
			$grosze = $explode[0].$explode[1];
			$session = md5(time());
			$session_id = substr($session,0, 7);
			
		?>
		<form action="https://www.platnosci.pl/paygw/ISO/NewPayment" method="post" name="payform">
		<input type="hidden" name="first_name" value="<?php echo $this->name; ?>">
		<input type="hidden" name="last_name" value="<?php echo $this->surname; ?>">
		<input type="hidden" name="email" value="<?php echo $this->email; ?>">	
		<input type="hidden" name="pos_id" value="39289">
		<input type="hidden" name="pos_auth_key" value="cVQb72R">
		<input type="hidden" name="session_id" value="<?php echo $session_id;?>">
		<input type="hidden" name="order_id" value="<?php echo $this->nr_order;?>">
		<input type="hidden" name="amount" value="<?php echo preg_replace( '/\ /', '', $grosze ); ?>">
		<input type="hidden" name="desc" value="<?php echo $this->nr_order; ?>">
		<input type="hidden" name="client_ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
		
		<?php if( $grosze > 0 ) { ?>
		<input type="image" src="<?php echo $this->baseUrl() ?>/public/images/poprzezplatnosci.jpg" alt="Zapłać poprzez Platnosci.pl" value="Zapłać poprzez Platnosci.pl">
		<?php } ?>
		</form>
		<?php } elseif ($this->payment == 'p4') {
		
			$suma = number_format( ($this->basket->sumInt + $this->basket->deliveryInt) - $this->basket->sess->basket['value_vouchers'], 2, '.', ' ' );
			$explode = explode(".", $suma);
			$grosze = $explode[0].$explode[1];
			$session = md5(time());
			$session_id = substr($session,0, 7);
			
		?>
		<form action="https://www.platnosci.pl/paygw/ISO/NewPayment" method="post" name="payform">
		<input type="hidden" name="pay_type" value="b">
		<input type="hidden" name="first_name" value="<?php echo $this->name; ?>">
		<input type="hidden" name="last_name" value="<?php echo $this->surname; ?>">
		<input type="hidden" name="email" value="<?php echo $this->email; ?>">	
		<input type="hidden" name="pos_id" value="39289">
		<input type="hidden" name="pos_auth_key" value="cVQb72R">
		<input type="hidden" name="session_id" value="<?php echo $session_id;?>">
		<input type="hidden" name="order_id" value="<?php echo $this->nr_order;?>">
		<input type="hidden" name="amount" value="<?php echo preg_replace( '/\ /', '', $grosze ); ?>">
		<input type="hidden" name="desc" value="<?php echo $this->nr_order; ?>">
		<input type="hidden" name="client_ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
		
		<?php if( $grosze > 0 ) { ?>
		<input type="image" src="<?php echo $this->baseUrl() ?>/public/images/poprzezplatnosci.jpg" alt="Zapłać poprzez Platnosci.pl" value="Zapłać poprzez Platnosci.pl">
		<?php } ?>
		</form>
		<?php }?>
		</td>
		<td class="aright" style="vertical-align:top"><a href="<?php echo $this->baseUrl() ?>/shop/orders/fav/<?php echo $this->nr_order?>/proforma/1" class="cyellow"><?php echo $this->translate( 'print_order' ) ?></a></td>
		</tr>
		</table>

		
	</div>
<?php } 
$this->basket->clear();
?>
